import request from '@/utils/request'

export function oneClasList (data) { //一级分类
 return request({
   url: '/mall-goods/mall-goods-category/tree',
   method: 'get',
   params : data
 })
}
export function twoClasList (data) { //二级分类
 return request({
   url: '/mall-goods/mall-goods-brand/search',
   method: 'get',
   params : data
 })
}
export function addCompileProduct (data,method) { //新增编辑商品
 return request({
   url: '/mall-goods/mall-goods/basic',
   method: method,
   data
 })
}
export function getClassBrand (categoryId) { //获取分类+品牌列表
 return request({
   url: '/mall-goods/mall-goods/basic',
   method: 'get',
   params : {categoryId}
 })
}
export function getattrs (categoryId) {//获取类目下关联的属性列表
  return request({
    url: '/mall-goods/mall-goods/attrs',
    method: 'get',
    params : {categoryId}
  })
}
export function getImg (goodsId) {//获取商品图片-列表（主图、轮播图）
  return request({
    url: '/mall-goods/mall-goods-picture',
    method: 'get',
    params : {goodsId}
  })
}
export function addImg (data) {//商品图片（主图）-添加
  return request({
    url: '/mall-goods/mall-goods-picture',
    method: 'post',
    data
  })
}
export function addmultipleImg (data) {//商品图片（主图）-添加商品轮播图-多张
  return request({
    url: '/mall-goods/mall-goods-picture/carousel',
    method: 'post',
    data
  })
}

export function upMultipleImg (data) { //上传图片(多张)
  console.log(data);
  return request({
    url: '/osscenter/upfile/img/base64/multipart',
    method: 'post',
    data
  })
}

export function commodityList (data) { //商品列表
  return request({
    url: '/mall-goods/mall-goods/search',
    method: 'get',
    params : data
  })
}
export function addAttribute (data) { //【商品属性】属性添加
  return request({
    url: '/mall-goods/mall-goods/attrs',
    method: 'post',
    data
  })
}
export function addqa (data) { //商品问题-新增
  return request({
    url: '/mall-goods/mall-goods-question',
    method: 'post',
    data
  })
}
export function qaList (goodsId) { //问题列表
  return request({
    url: '/mall-goods/mall-goods-question/search',
    method: 'get',
    params : {goodsId}
  })
}
export function delqa (mgqId) { //问题列表
  return request({
    url: '/mall-goods/mall-goods-question',
    method: 'DELETE',
    data : mgqId
  })
}
export function addText (data,method) { //商品详细介绍（富文本）-添加或更新
  return request({
    url: '/mall-goods/mall-goods-ins',
    method : method,
    data
  })
}
export function textDetails (goodsId) { //商品详细介绍（富文本）-详情
  return request({
    url: '/mall-goods/mall-goods-ins',
    method : 'get',
   params : {goodsId}
  })
}
